<?xml version="1.0" encoding="UTF-8"?>
<ui:composition template="/pages/layout/masterlayout.xhtml"
	xmlns="http://www.w3c.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:define name="pageTitle">MyPartyManager - #{msg['entity.party.list']}</ui:define>

	<ui:define name="header">

		<h3>#{msg['entity.party.list']}</h3>

	</ui:define>

	<ui:define name="content">

		<h:form id="formParty">
		
			<h:commandButton action="#{partyBean.create}" value="#{msg['app.controlers.button.new']}" />
			
			<div class="divDataTable">
				
				<p:dataTable var="party" value="#{partyBean.userParties}" paginator="true" rows="10">

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['entity.party.name']}" />
						</f:facet>
						<h:outputText value="#{party.name}" />
					</p:column>
	
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['entity.party.partyDate']}" />
						</f:facet>
						<h:outputText value="#{party.partyDate}" />
					</p:column>

					<p:column style="width:32px">
						<h:commandButton action="#{partyBean.view}" value="#{msg['app.controlers.button.view']}">
							<f:setPropertyActionListener value="#{party}" target="#{partyBean.party}" />
						</h:commandButton>
					</p:column>
					
					<p:column style="width:32px">
						<h:commandButton action="#{partyBean.edit}" value="#{msg['app.controlers.button.edit']}">
							<f:setPropertyActionListener value="#{party}" target="#{partyBean.party}" />
						</h:commandButton>
					</p:column>
					
					<p:column style="width:32px">
						<p:commandButton actionListener="#{partyBean.prepareDelete}" value="#{msg['app.controlers.button.delete']}" onclick="confirmation.show()" type="button">
							<f:setPropertyActionListener value="#{party}" target="#{partyBean.party}" />
						</p:commandButton> 
					</p:column>
					
				</p:dataTable>
				
			</div>
			
			<!--  confirm delete -->
			<p:confirmDialog message="#{msg['app.delete.confirm']}" showEffect="puff" hideEffect="explode" header="#{msg['entity.party.delete.confirm']}" severity="alert" widgetVar="confirmation" modal="true">  
				<p:commandButton value="#{msg['app.controlers.button.yes']}" update="messages" oncomplete="confirmation.hide()" actionListener="#{partyBean.delete}" />
				<p:commandButton value="#{msg['app.controlers.button.no']}" onclick="confirmation.hide()" type="button" />   
			</p:confirmDialog>

		</h:form>

	</ui:define>

</ui:composition>

